#include<iostream>
#include<cassert>
#include<unistd.h>
#include<pthread.h>

using namespace std;

//新线程
void* routine(void* args)
{
    char* msg = static_cast<char*>(args);
     while(true)
    {
        cout<< msg <<":我是新线程，正在运行！"<<endl;
        sleep(1);
    }
}

int main()
{
    pthread_t tid;  
    int n = pthread_create(&tid,nullptr,routine,(void*)"thread one");
    assert(0==n);
    (void)n;
    //主线程
    while(true)
    {
        cout<<"我是主线程，正在运行！"<<endl;
        sleep(1);
    }
    return 0;
}